<template>
	<view class="content">
		<view class="forget-bg">
			<view class="forget-card">
				<view class="forget-input forget-margin-b">
					<input type="text" placeholder="请输入您的用户名" v-model="username"/>
				</view>
				<view class="forget-input forget-margin-b">
					<input type="text" placeholder="请输入您的邮箱" v-model="email" />
				</view>
				<view class="forget-input forget-margin-b">
					<input type="text" placeholder="请输入您的手机号" v-model="mobile" />
				</view>
				<!-- <view class="forget-input forget-margin-b">
					<view class="verify-left">
						<input type="number" placeholder="请输入验证码" />
					</view>
					<view class="verify-right">
						<button class="verify-btn" type="primary">获取验证码</button>
					</view>
				</view> -->
				<view class="forget-input">
					<input type="password" placeholder="请输入密码(6-16位)" v-model="password" />
				</view>
			</view>
		</view>
		<view class="forget-btn">
			<button class="landing" type="primary" @click="register()">提交</button>
		</view>
	</view>
</template>

<script>
	// 公共
	import common from '@/common/common.js'
	
	// 请求接口
	import $http from '@/utils/api/login.js';
	
	// 请求接口
	// import $prize from '@/utils/api/prize.js';
	export default {
		data() {
			return {
				title: 'Hello',
				username: '',
				password: '',
				email: '',
				mobile: ''
			}
		},
		onLoad() {

		},
		methods: {
			register(){
				let params = {
					username: this.username,
					password: this.password,
					email: this.email,
					mobile: this.mobile
				}
				
				$http.register(params, 'POST').then(res => {
					console.log(res);
					if(res.code == 0){
						uni.showToast({
							title: res.msg,
							icon: 'none',
							duration: 1500
						});
					}
					
					if(res.code == 1){
						uni.showToast({
							title: res.msg,
							icon: 'success',
							duration: 1500
						});
						setTimeout(function(){
							uni.navigateTo({
								url: '../login/login'
							})
						},1500)
					}
				});
			}
		}
	}
</script>

<style>
	.verify-left{
		width: calc(100% - 260upx);
	}
	.verify-right{
		padding-left: 20upx;
	}
	.verify-btn{
		height: 80upx;
		line-height: 80upx;
		font-size: 28upx;
		width: 240upx;
		border-radius: 8upx;
		background: linear-gradient(left,#FF978D, #FFBB69);
	}
	.verify-left,.verify-right{
		float: left;
	}
	.landing{
		height: 84upx;
		line-height: 84upx;
		border-radius: 44upx;
		font-size: 32upx;
		background: linear-gradient(left,#FF978D, #FFBB69);
	}
	.forget-btn{
		padding: 10upx 20upx;
		margin-top: 380upx;
	}

	.forget-input input{
		background: #F2F5F6;
		font-size: 28upx;
		padding: 10upx 25upx;
		height: 62upx;
		line-height: 62upx;
		border-radius: 8upx;
	}
	.forget-margin-b{
		margin-bottom: 25upx;
	}
	.forget-input{
		padding: 10upx 20upx;
		overflow: auto;
	}
	.forget-card{
		background: #fff;
		border-radius: 12upx;
		padding: 60upx 25upx;
		box-shadow: 0 6upx 18upx rgba(0,0,0,0.12);
		position: relative;
		margin-top: 120upx;
	}
	.forget-bg {
		height: 260upx;
		padding: 25upx;
		background: linear-gradient(#FF978D, #FFBB69);
	}
</style>
